package com.gitee.wsl.data.savable

import kotlin.reflect.KType
import kotlin.reflect.typeOf

interface Savable {
    fun <T> saveState(key: String, kType: KType, value: T?)
    fun <T> restoreState(key: String, kType: KType): T?
}

 inline fun <reified T> Savable.saveState(key: String, value: T) {
    saveState(key, typeOf<T>(), value)
}

 inline fun <reified T> Savable.restoreState(key: String): T? {
    return restoreState(key, typeOf<T>())
}


